function W=Efficient_weight(data,theta)
%Calculates the efficient weighting matrix based on Newey West Covariance
%estimator applied to the Hansen and Singleton moment conditions
gmat=HS_moment_condition_generalized(data,theta,0); %Evaluate Hansen and Singleton moments
Sigma=NW_hac(gmat); %Calculate variance matrix of moments
W=Sigma^-1; %Invert variance matrix to get weights
end

